package cn.shyouchi.wuguanjia.android.ui.event.train;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/10/27 at 15:41
 * Email: 472279981@qq.com
 * Des:
 */

public class TrainAdapter extends BaseQuickAdapter<TrainEntity.ResultMessageBean,BaseViewHolder> {
    TrainContract.View mView;
    public TrainAdapter(List<TrainEntity.ResultMessageBean> data, TrainContract.View view) {
        super(R.layout.item_event_train_layout, data);
        this.mView = view;
    }

    @Override
    protected void convert(BaseViewHolder holder, final TrainEntity.ResultMessageBean entity) {
        holder.setText(R.id.tv_train_name, entity.getTrainingname());

        holder.getView(R.id.item_layout).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onItemClick(entity);
            }
        });

        holder.getView(R.id.btn_del).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onDelClick(entity);
            }
        });
    }
}
